<?php
$server = "localhost";
$username = "root";
$password = "";
$database = "gesproy";

$con = mysql_connect($server, $username, $password) or die("No se conecto: " . mysql_error());

mysql_select_db($database, $con);
?>
<!DOCTYPE html>
<html>
    <head>
        <title>GESPROY v1.0</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width">
        <link rel="stylesheet"  href="../css/themes/default/jquery.mobile-1.3.1.min.css">
        <link rel="stylesheet"  href="../css/estilo.css">
        <script src="../js/static/jquery.js"></script>
        <script src="../js/static/jquery.mobile-1.3.1.min.js"></script>
        <script src="../js/manejadorbd.js"></script>  
        <script type="text/javascript" src="../js/ahah.js"></script>      
    </head>
    <body>
        <section data-role="page" id="crearusuario" data-theme="b">
            <header data-role="header" data-theme="b" data-position="fixed">
                <a href="#" data-role="button" data-rel="back" data-icon="back" data-iconpos="notext">Volver</a>
                <h1>Generar Informes</h1>
                <a data-rel="dialog" href="#ajustes" class="ui-btn-right" data-icon="delete" data-iconpos="notext">Ajustes</a>
            </header>            
            <article data-role="content">
                <form id="form_crear_usuario" method="get" action="cargarInforme.php">
                    <div data-role="fieldcontain">
                        <label for="programa">Programa Academico:</label> 
                        <select name="programa" id="programa"> 
                            <option value="0">Seleccione...</option>
                            <?php
                            $resultList = mysql_query("SELECT IDPROGRAMA,NOMBRE FROM programa", $con);
                            while ($rowList = mysql_fetch_array($resultList)) {

                                $valor = $rowList["IDPROGRAMA"];
                                $nombre = utf8_encode($rowList["NOMBRE"]);
                                echo "<option value=" . $valor . ">" . $nombre . "</option>";
                            }
                            ?>
                        </select>
                    </div>
                    <div data-role="fieldcontain">
                        <label for="docente">Docente:</label> 
                        
                        <select name="docente" id="docente" onchange="cargarModulos(this.value);" data-ajax="false">
                            <option selected="selected" value="0">Seleccione...</option>
                          <?php 
                          $resultUsua = mysql_query("SELECT IDUSUARIO,CONCAT(NOMBRES,  ' ', APELLIDOS) as NOMBRE FROM usuario WHERE IDROL = 2 ", $con);
                            
                            while ($rowList = mysql_fetch_array($resultUsua)) {
								$valor = $rowList["IDUSUARIO"];
                                $nombre = $rowList["NOMBRE"];
                            	echo "<option value=" . $valor . ">" . $nombre . "</option>";
                            }
                          ?>
                          </select>
                    </div>
                    
                    <div data-role="fieldcontain">
                    <div id="divModulos" data-role="fieldcontain"></div>
                    </div>
                    <div data-role="fieldcontain">
                        <label for="txtfecha">fecha:</label> 
                        <input type="date" id="txtfecha" value="" />
                    </div>
                    
<!--                    <input type="button" value="Generar informe" id="btnGuardarinforme" />-->
						<input type="submit" value="Generar informe" />
                  <!--  <a href="cargarInforme.php" rel="external" data-role="button" >Generar informe</a> -->
                </form>
            </article>
        </section>

        <section data-role="dialog" id="ajustes" data-theme="b">
            <header data-role="header" data-theme="b">
                <h1>Cerrar sesión</h1>
            </header>            
            <article data-role="content">
                <center>
                    <p>¿ Seguro que quieres cerrar sesión ?</p>

                    <table>
                        <tr>
                            <td>
                                <a href="#" data-role="button"  data-rel="back" data-theme="a">No</a>
                            </td>
                            <td>
                                <a href="../index.html" rel="external" data-role="button" data-theme="e">Cerrar Sesión</a>
                            </td>
                        </tr>
                    </table>
                </center>
            </article>
        </section>         
    </body>
</html>
